<%@page contentType="text/html; charset=UTF-8"%>
<%@taglib uri="/WEB-INF/struts-tags.tld" prefix="s"%>
<%@taglib uri="/WEB-INF/dianning.tld" prefix="dianning"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta content="zh-cn" http-equiv="Content-Language" />
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>设置置顶</title>
<link href="/css/infotop.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" charset="utf-8"  src="/js/jquery-1.4.2.min.js"></script>
<script>


var selectTime = 0;
var userAmount =0;

$(	function(){
	selectTime = parseInt($("#timelength1").val());
	userAmount = parseInt($("#newUseramount").val());
	refresh_computeAmount();
	var frm = parent.$("#<s:property value="frm" escape="false"/>_<s:property value="id"/>");
	frm.css("height", "315px");
	}
)
//选择时间
function refresh_selectTime(obj){
	var currDays=1;
	var temp = parseInt(obj.value);
	if(temp==5){
		currDays=1;
	}
	if(temp==10){
		currDays=3;
	}
	if(temp==75){
		currDays=15;
	}
	if(temp==150){
		currDays=30;
	}
	if(temp==450){
		currDays=90;
	}
    var date = new Date();
    date.setDate(date.getDate() + currDays);
    var year = date.getFullYear();
    var m = date.getMonth() + 1;
	var month = (m < 10) ? '0' + m : m;
	var d  = date.getDate();
	var day = (d < 10) ? '0' + d : d;
	var endtime = year+"-"+month+"-"+day;
	$("#refresh_endtime").html(endtime);

	var timeLength = obj.value;
	timeLength = parseInt(timeLength);
	selectTime = timeLength;
	refresh_computeAmount();
}

//计算所需的金额
function refresh_computeAmount(){
	var amountCount = selectTime;
	$("#refresh_AmountCount").html(amountCount);
	$("#refresh_UserAmount").html(userAmount);
	if ((userAmount) < (amountCount)) {
		$("#refresh_pay").css("display","none")
		$("#refresh_buzu").css("display","");
    }else {
		$("#refresh_pay").css("display","");
		$("#refresh_buzu").css("display","none");
    }
}
</script>
</head>

<body>

	<div class="mbottom">
		<div class="newzd"> 
			<div class="zdbody">
			<!-- 置顶主体开始 -->
				<div class="zdtit">
					<ul>
						<li><span><a href="info.action?action=refresh&frm=<s:property value="frm" escape="false"/>&id=<s:property value="id"/>">刷新</a></span></li>
						<li class="select"><span><a href="info.action?action=autorefresh&frm=<s:property value="frm" escape="false"/>&id=<s:property value="id"/>">定时刷新</a></span></li>
						<li><span><a href="info.action?action=top&frm=<s:property value="frm" escape="false"/>&id=<s:property value="id"/>">置顶</a></span></li>
						<li><span><a href="info.action?action=autotop&frm=<s:property value="frm" escape="false"/>&id=<s:property value="id"/>">委托置顶</a></span></li>
					</ul>
				</div>
				<div class="clear"></div>
				<div class="zdinfo">
					<s:if test="message=='true'">
					<div class="yellow-b">己经委托刷新</div>
					</s:if>
					<s:if test="reserves != null">
					<div class="yellow-b">您己经委托刷新该信息</div>
					</s:if>
					<s:else>
					
					<div class="tjzd">		
								<div class="yellow-b">每天每4小时刷新一次，一天6次</div>			
								<table border="0" cellpadding="0" cellspacing="0" class="tjzdtable">
								<form name="free" id="free" method="post" action="info.action">
								<input name="action" id="action" type="hidden" value="doautorefresh" />
								<input name="id" id="id" type="hidden" value="<s:property value="id"/>" />
								<input type="hidden" id="newUseramount" value="<s:property value="money.points"/>"/>
								<tr>
									<td class="tdwt">选择刷新时长：</td> 
									<td>
									
									<input name="timelength" onclick="refresh_selectTime(this)" id="timelength1" type="radio" value="5" checked />1天
									<input name="timelength" onclick="refresh_selectTime(this)" id="timelength2" type="radio" value="10" />3天
									<input name="timelength" onclick="refresh_selectTime(this)" id="timelength3" type="radio" value="75" />15天
									<input name="timelength" onclick="refresh_selectTime(this)" id="timelength4" type="radio" value="150" />30天
									<input name="timelength" onclick="refresh_selectTime(this)" id="timelength5" type="radio" value="450" />90天
									</td>
								</tr>
								<tr><td class="tdwt"></td>
									<td>
									<span class="gray mr10">您选择的刷新时间为<b class="red">
									<s:date name="today" format="yyyy-MM-dd"/>
									</b>至<b class="red" id="refresh_endtime">
									<s:date name="tomorrow" format="yyyy-MM-dd"/>
									</span>
									</td>
								</tr>
								<tr>
									<td colspan="2">
										<div class="yellow-b">
										<table width="100%" border="0">
										<tr>
											<td>此次置顶需要花费您<span class="red" id="refresh_AmountCount"></span>积分，
												<span id="refresh_tishi">您的可用余额为<span class="red" id="refresh_UserAmount"></span>积分。</span>
												<span id="refresh_buzu">余额不足</span>
											</td>
										</tr>
										</table>
										</div>
									</td>
								</tr>
								<tr>
									<td class="tdwt">&nbsp;&nbsp;</td>
									<td><span class="tyzdbut"  id="refresh_pay">
										  <label class="butt">
										  <input name="" type="submit" value="定时刷新" class="btns" />
										  </label>
									</span>
									</td>
								</tr>
								</form>
								</table>
					</div>
				</s:else>	
			</div>
		</div>
	</div>
	
</body>
</html>
